Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max skew time + batch submission time calculation refactor #1283

Merged
merged 5 commits into from
Dec 20, 2024

Conversation

srene
Copy link
Contributor

@srene srene commented Dec 16, 2024

PR Standards

This PR solves two issues:

  • submission time when no state update is submitted should take first block as a reference, and no the genesis time (to calculate skew time).
  • batch_submission_time (config) should be based on submissions time, and no based on block times, otherwise it maybe that the submissions are not exactly every batch_submission_time when no block production.

Close #1282 ,#1287

<-- Briefly describe the content of this pull request -->

For Author:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

@srene srene requested a review from a team as a code owner December 16, 2024 15:21
@@ -314,11 +311,36 @@ func (m *Manager) UpdateLastSubmittedHeight(event pubsub.Message) {
}
}

func (m *Manager) GetLastBlockInSettlementTime() (time.Time, error) {
lastBlockInSettlement, err := m.Store.LoadBlock(m.LastSettlementHeight.Load())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the LastSettlementHeight may get pruned no?

pruningHeight = min(m.NextHeightToSubmit(), uint64(retainHeight))

if that's the case and we fallback to first block it may cause unnecessary halt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true. good catch. i keep last submitted block without pruning to enable skew time calculation and keep code simplicity.

@srene srene requested a review from omritoptix December 18, 2024 08:29
@danwt
Copy link
Contributor

danwt commented Dec 19, 2024

#1282

@srene srene marked this pull request as draft December 19, 2024 10:43
@srene srene force-pushed the srene/1282-max-skew-time-fix branch from f9a7024 to 82abf78 Compare December 19, 2024 11:34
@srene srene changed the title skew time using first block when no state update max skew time + batch submission time calculation refactor Dec 19, 2024
@srene srene self-assigned this Dec 19, 2024
@srene srene marked this pull request as ready for review December 19, 2024 13:46
omritoptix
omritoptix previously approved these changes Dec 19, 2024
block/submit.go Outdated

// isLastBatchRecent returns true if the last batch submitted is more recent than submitBatchTime
// in case of no submission time the first block produced is used as a reference.
func (m *Manager) isLastBatchRecent(submitBatchTime time.Duration) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

submitBatchTime -> maxBatchSubmitTime

if we don't keep this names clear it becomes really really complicated understanding what each function does.

@omritoptix omritoptix merged commit e2308e3 into main Dec 20, 2024
4 checks passed
@omritoptix omritoptix deleted the srene/1282-max-skew-time-fix branch December 20, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants